import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/home/Home.vue'
import Supervise from '@/components/content/Supervise.vue'
import Message from '@/components/message/Message.vue'
import My from '@/components/my/My.vue'
import Publish from '@/components/publish/Publish.vue'
import Help from '@/components/publish/Help.vue'
import PublishIdle from '@/components/publish/PublishIdle.vue'
import ToRent from '@/components/publish/ToRent.vue'
import Topic from '@/components/message/Topic.vue'
import Reply from '@/components/message/Reply.vue'
import Unused from '@/components/home/Unused.vue'
import Governance from '@/components/home/Governance.vue'
import InCome from '@/components/home/InCome.vue'
import GoverPay from '@/components/home/GoverPay.vue'
import GoverAll from '@/components/home/GoverAll.vue'
import ViewVoucher from '@/components/home/ViewVoucher.vue'
import LookDetail from '@/components/home/LookDetail.vue'
import RentSale from '@/components/home/RentSale.vue'
import TeamList from '@/components/content/TeamList.vue'
import ChoseCity from '@/components/home/ChoseCity.vue'
import VillageNotice from '@/components/home/VillageNotice.vue'
import VillageDetail from '@/components/home/VillageDetail.vue'
import RentDetail from '@/components/home/RentDetail.vue'
import ChosePlot from '@/components/home/ChosePlot.vue'
import UnusedDetail from '@/components/home/UnusedDetail.vue'
import EditAdress from '@/components/home/EditAddress.vue'
import SelectAddress from '@/components/home/SelectAddress.vue'
import EditData from '@/components/my/EditData.vue'
import MyLabel from '@/components/my/MyLabel.vue'
import Opinion from '@/components/my/Opinion.vue'
import AboutUs from '@/components/my/AboutUs.vue'
import SeekHelp from '@/components/home/SeekHelp.vue'
import HelpDetail from '@/components/home/HelpDetail.vue'
import MyIdle from '@/components/my/MyIdle.vue'
import IdleDetail from '@/components/my/IdleDetail.vue'
import Repairs from '@/components/home/Repairs.vue'
import Vote from '@/components/home/Vote.vue'
import MyVillage from '@/components/my/MyVillage.vue'
import MyHouse from '@/components/my/MyHouse.vue'
import HouseConfirm from '@/components/my/HouseConfirm.vue'
import RepairsDetail from '@/components/home/RepairsDetail.vue'
import Voting from '@/components/home/Voting.vue'
import VotingDetail from '@/components/home/VotingDetail.vue'
import MyVote from '@/components/my/MyVote.vue'
import MyVoteResult from '@/components/my/MyVoteResult.vue'
import Result from '@/components/my/Result.vue'
import Repair from '@/components/publish/Repair.vue'
import OpinionDetail from '@/components/my/OpinionDetail.vue'
import Service from '@/components/content/Service.vue'
import TeamAll from '@/components/content/TeamAll.vue'
import ServiceDetail from '@/components/content/ServiceDetail.vue'
import TeamDetail from '@/components/content/TeamDetail.vue'
import CardCount from '@/components/content/CardCount.vue'
import WeekCardDetail from '@/components/content/WeekCardDetail.vue'
import MonthCardDetail from '@/components/content/MonthCardDetail.vue'
import PrevMonthCardDetail from '@/components/content/PrevMonthCardDetail.vue'
import DayCardDetail from '@/components/content/DayCardDetail.vue'
import PrevQuarterDetail from '@/components/content/PrevQuarterDetail.vue'
import Release from '@/components/content/Release.vue'
import Clocked from '@/components/content/Clocked.vue'
import Looked from '@/components/content/Looked.vue'
import Breaked from '@/components/content/Breaked.vue'
import PrevQuarter from '@/components/content/PrevQuarter.vue'
import HalfYear from '@/components/content/HalfYear.vue'
import Editdata1 from '@/components/my/Editdata1.vue'
import Check from '@/components/content/Check.vue'
import CheckPublish from '@/components/content/CheckPublish.vue'
import CheckDetailList from '@/components/content/CheckDetailList.vue'
import CheckDetail from '@/components/content/CheckDetail.vue'
import StartCheck from '@/components/content/StartCheck.vue'
import GoCheckPublish from '@/components/content/GoCheckPublish.vue'
import Ident from '@/components/my/Ident.vue'
import MyCheck from '@/components/my/MyCheck.vue'
import EditCheck from '@/components/my/EditCheck.vue'
import EditCheckEvery from '@/components/my/EditCheckEvery.vue'
import IdentList from '@/components/my/IdentList.vue'
import IdentDetail from '@/components/my/IdentDetail.vue'
import Statistics from '@/components/my/Statistics.vue'
import StatisticsDetail from '@/components/my/StatisticsDetail.vue'
import AlreadyRecycle from '@/components/my/AlreadyRecycle.vue'
import AlreadySendVote from '@/components/my/AlreadySendVote.vue'
import AlreadyVote from '@/components/my/AlreadyVote.vue'
import LookVoteDetail from '@/components/my/LookVoteDetail.vue'
import ToExamine from '@/components/content/ToExamine.vue'
import MyRecord from '@/components/content/MyRecord.vue'
import ExamineDetail from '@/components/content/ExamineDetail.vue'
import TakeIn from '@/components/home/TakeIn.vue'
import TakeInDetail from '@/components/home/TakeInDetail.vue'
import TakeInResult from '@/components/home/TakeInResult.vue'
import TicketRoot from '@/components/home/TicketRoot.vue'
import VotingList from '@/components/home/VotingList.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  // scrollBehavior (to, from, savedPosition) {
  //   if (savedPosition) {
  //     return savedPosition
  //   } else {
  //     return {
  //       x: 0,
  //       y: 0
  //     }
  //   }
  // },
  // scrollBehavior (to, from, savedPosition) {
  //   if (savedPosition) {
  //     return savedPosition
  //   } else {
  //     if (from.meta.keepAlive) {
  //       from.meta.savedPosition = document.body.scrollTop
  //     }
  //     return {
  //       x: 0,
  //       y: to.meta.savedPosition || 0
  //     }
  //   }
  // },
  linkActiveClass: 'active',
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/Editdata1',
      name: 'Editdata1',
      component: Editdata1
    },
    {
      path: '/Supervise',
      name: 'Supervise',
      component: Supervise,
      redirect: '/TeamList',
      children: [
        {
          path: '/TeamList',
          name: 'TeamList',
          component: TeamList
        },
        {
          path: '/Service',
          name: 'Service',
          component: Service,
          meta: {
            keepAlive: true,
            isBack: false
          }
        },
        {
          path: '/Check',
          name: 'Check',
          component: Check,
          meta: {
            keepAlive: true,
            isBack: false
          }
        }
      ]
    },
    {
      path: '/message',
      name: 'Message',
      component: Message,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/my',
      name: 'My',
      component: My,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/publish',
      name: 'Publish',
      component: Publish
    },
    {
      path: '/publish/Help',
      name: 'Help',
      component: Help
    },
    {
      path: '/publish/PublishIdle',
      name: 'PublishIdle',
      component: PublishIdle
    },
    {
      path: '/publish/ToRent',
      name: 'ToRent',
      component: ToRent
    },
    {
      path: '/message/Topic',
      name: 'Topic',
      component: Topic
    },
    {
      path: '/message/Reply/:id',
      name: 'Reply',
      component: Reply
    },
    {
      path: '/home/Unused',
      name: 'Unused',
      component: Unused,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/home/Governance',
      name: 'Governance',
      component: Governance,
      redirect: '/home/InCome',
      children: [
        {
          path: '/home/InCome',
          name: 'InCome',
          component: InCome
        },
        {
          path: '/home/GoverPay',
          name: 'GoverPay',
          component: GoverPay
        },
        {
          path: '/home/GoverAll',
          name: 'GoverAll',
          component: GoverAll
        }
      ]
    },
    {
      path: '/home/RentSale',
      name: 'RentSale',
      component: RentSale,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/home/ChoseCity',
      name: 'ChoseCity',
      component: ChoseCity
    },
    {
      path: '/home/ChosePlot/:id',
      name: 'ChosePlot',
      component: ChosePlot
    },
    {
      path: '/home/VillageNotice/:id',
      name: 'VillageNotice',
      component: VillageNotice,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/home/VillageDetail/:id',
      name: 'VillageDetail',
      component: VillageDetail
    },
    {
      path: '/home/RentDetail/:id',
      name: 'RentDetail',
      component: RentDetail
    },
    {
      path: '/home/UnusedDetail/:id',
      name: 'UnusedDetail',
      component: UnusedDetail
    },
    {
      path: '/my/EditData',
      name: 'EditData',
      component: EditData
    },
    {
      path: '/my/MyLabel',
      name: 'MyLabel',
      component: MyLabel
    },
    {
      path: '/my/Opinion',
      name: 'Opinion',
      component: Opinion
    },
    {
      path: '/home/EditAddress',
      name: 'EditAddress',
      component: EditAdress
    },
    {
      path: '/home/SelectAddress',
      name: 'SelectAddress',
      component: SelectAddress
    },
    {
      path: '/my/AboutUs',
      name: 'AboutUs',
      component: AboutUs
    },
    {
      path: '/home/SeekHelp',
      name: 'SeekHelp',
      component: SeekHelp,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/home/HelpDetail/:id',
      name: 'HelpDetail',
      component: HelpDetail
    },
    {
      path: '/my/MyIdle',
      name: 'MyIdle',
      component: MyIdle,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/my/IdleDetail/:name/:id',
      name: 'IdleDetail',
      component: IdleDetail
    },
    {
      path: '/home/Repairs',
      name: 'Repairs',
      component: Repairs,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/home/Vote/:id',
      name: 'Vote',
      component: Vote
    },
    {
      path: '/home/TakeIn/:id',
      name: 'TakeIn',
      component: TakeIn
    },
    {
      path: '/home/TakeInDetail/:id',
      name: 'TakeInDetail',
      component: TakeInDetail
    },
    {
      path: '/home/TakeInResult/:id',
      name: 'TakeInResult',
      component: TakeInResult
    },
    {
      path: '/my/MyVillage/:id',
      name: 'MyVillage',
      component: MyVillage
    },
    {
      path: '/my/MyHouse',
      name: 'MyHouse',
      component: MyHouse
    },
    {
      path: '/my/HouseConfirm',
      name: 'HouseConfirm',
      component: HouseConfirm
    },
    {
      path: '/home/RepairsDetail/:id',
      name: 'RepairsDetail',
      component: RepairsDetail
    },
    {
      path: '/home/VotingList',
      name: 'VotingList',
      component: VotingList
    },
    {
      path: '/home/Voting/:id',
      name: 'Voting',
      component: Voting,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/home/VotingDetail/:id',
      name: 'VotingDetail',
      component: VotingDetail
    },
    {
      path: '/home/TicketRoot',
      name: 'TicketRoot',
      component: TicketRoot
    },
    {
      path: '/my/MyVote',
      name: 'MyVote',
      component: MyVote,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/my/MyVoteResult/:type/:id',
      name: 'MyVoteResult',
      component: MyVoteResult
    },
    {
      path: '/my/Result/:id',
      name: 'Result',
      component: Result
    },
    {
      path: '/publish/Repair',
      name: 'Repair',
      component: Repair
    },
    {
      path: '/my/OpinionDetail/:id',
      name: 'OpinionDetail',
      component: OpinionDetail
    },
    {
      path: '/TeamAll/:id',
      name: 'TeamAll',
      component: TeamAll
    },
    {
      path: '/ServiceDetail/:id',
      name: 'ServiceDetail',
      component: ServiceDetail
    },
    {
      path: '/TeamDetail/:id',
      name: 'TeamDetail',
      component: TeamDetail
    },
    {
      path: '/CardCount/:id',
      name: 'CardCount',
      component: CardCount
    },
    {
      path: '/WeekCardDetail/:id',
      name: 'WeekCardDetail',
      component: WeekCardDetail
    },
    {
      path: '/Release',
      name: 'Release',
      component: Release
    },
    {
      path: '/Clocked',
      name: 'Clocked',
      component: Clocked
    },
    {
      path: '/Looked',
      name: 'Looked',
      component: Looked,
      redirect: '/ToExamine',
      children: [
        {
          path: '/ToExamine',
          name: 'ToExamine',
          component: ToExamine
        },
        {
          path: '/MyRecord',
          name: 'MyRecord',
          component: MyRecord
        }
      ]
    },
    {
      path: '/Breaked',
      name: 'Breaked',
      component: Breaked
    },
    {
      path: '/MonthCardDetail/:id',
      name: 'MonthCardDetail',
      component: MonthCardDetail
    },
    {
      path: '/PrevMonthCardDetail/:id',
      name: 'PrevMonthCardDetail',
      component: PrevMonthCardDetail
    },
    {
      path: '/PrevQuarter/:id',
      name: 'PrevQuarter',
      component: PrevQuarter
    },
    {
      path: '/HalfYear/:id',
      name: 'HalfYear',
      component: HalfYear
    },
    {
      path: '/DayCardDetail/:id',
      name: 'DayCardDetail',
      component: DayCardDetail
    },
    {
      path: '/PrevQuarterDetail/:year/:month/:id',
      name: 'PrevQuarterDetail',
      component: PrevQuarterDetail
    },
    {
      path: '/CheckPublish',
      name: 'CheckPublish',
      component: CheckPublish
    },
    {
      path: '/CheckDetailList/:id',
      name: 'CheckDetailList',
      component: CheckDetailList
    },
    {
      path: '/CheckDetail/:id/:upid',
      name: 'CheckDetail',
      component: CheckDetail
    },
    {
      path: '/StartCheck/:id/:liftNum',
      name: 'StartCheck',
      component: StartCheck
      // meta: {
      //   keepAlive: true,
      //   isBack: false
      // }
    },
    {
      path: '/my/Ident',
      name: 'Ident',
      component: Ident
    },
    {
      path: '/GoCheckPublish/:id/:name/:relatedId/:liftNum/:hid/:mainid',
      name: 'GoCheckPublish',
      component: GoCheckPublish
    },
    {
      path: '/home/ViewVoucher/:id',
      name: 'ViewVoucher',
      component: ViewVoucher
    },
    {
      path: '/home/LookDetail/:type',
      name: 'LookDetail',
      component: LookDetail
    },
    {
      path: '/my/MyCheck',
      name: 'MyCheck',
      component: MyCheck
    },
    {
      path: '/my/EditCheck/:id/:categoryid',
      name: 'EditCheck',
      component: EditCheck
    },
    {
      path: '/my/EditCheckEvery/:id/:categoryid/:name/:liftNum',
      name: 'EditCheckEvery',
      component: EditCheckEvery
    },
    {
      path: '/my/IdentList',
      name: 'IdentList',
      component: IdentList
    },
    {
      path: '/my/IdentDetail/:id',
      name: 'IdentDetail',
      component: IdentDetail
    },
    {
      path: '/my/Statistics',
      name: 'Statistics',
      component: Statistics,
      meta: {
        keepAlive: true,
        isBack: false
      }
    },
    {
      path: '/my/StatisticsDetail/:aid/:vid',
      name: 'StatisticsDetail',
      component: StatisticsDetail
    },
    {
      path: '/my/AlreadyVote/:aid/:vid/:name',
      name: 'AlreadyVote',
      component: AlreadyVote
    },
    {
      path: '/my/AlreadySendVote/:aid/:vid/:name',
      name: 'AlreadySendVote',
      component: AlreadySendVote
    },
    {
      path: '/my/AlreadyRecycle/:aid/:vid/:name',
      name: 'AlreadyRecycle',
      component: AlreadyRecycle
    },
    {
      path: '/my/LookVoteDetail/:did/:vid',
      name: 'LookVoteDetail',
      component: LookVoteDetail
    },
    {
      path: '/ExamineDetail/:id',
      name: 'ExamineDetail',
      component: ExamineDetail
    }
  ]
})
